(() => {
    // 多态： 父类型的引用指向子类型的对象
    // 定义一个父类
    class Anaimal {
        constructor(name) {
            this.name = name;
        }
        run(distance = 0) {
            console.log(`${this.name} 跑了 ${distance}`);
        }
    }
    class Pig extends Anaimal {
        constructor(name) {
            super(name);
        }
        run(distance = 10) {
            super.run(distance);
        }
    }
    const ani = new Anaimal('动物');
    ani.run();
    const pig = new Pig('小猪');
    pig.run();
    function showRun(ani) {
        ani.run();
    }
    showRun(ani);
    showRun(pig);
})();
